package com.fasteat.menu.controller;

import com.fasteat.common.entity.Result;
import com.fasteat.menu.service.RecommendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author run
 * @since 2021/3/1 21:58
 */
@Api(tags = "推荐相关接口")
@CrossOrigin
@RestController
@RequestMapping("/fasteat/recommend")
public class RecommendController {

    @Autowired
    private RecommendService recommendService;

    @GetMapping("/{id}")
    @ApiOperation("获取用户的推荐关键词列表")
    public Result getRecommendList(@PathVariable(value = "id")String userId){
        return Result.success().data(recommendService.getRecommendKeywordOfUser(userId));
    }

    @PutMapping("/{id}/{page}/{size}")
    @ApiOperation("获取用户的推荐菜谱列表")
    public Result getRecommendList(@PathVariable(value = "id")String userId
                                    , @PathVariable(value = "page")Integer page
                                    , @PathVariable(value = "size")Integer size){
        return Result.success().data(recommendService.getRecommendList(userId, page, size));
    }

}
